<?php

class Admin_Form_UpdateZip extends Zend_Form {

    public function init() {
        /* Form Elements & Other Definitions Here ... */
    }

    public function main($info) {
        $this->setMethod('post');

        #name
        $name = new Zend_Form_Element_Text('codes');
        $name->setLabel('Zipcode:')
                ->setValue($info['codes']);

        #city id
        $cityDb = new Ads_Model_City();
        $cityArray = $cityDb->fetchAll();
        $city = new Zend_Form_Element_Select('city');
        $city->setLabel('City Name:')
                ->setRequired(true)
                ->addValidator('Int')
                ->addMultiOption(-1, 'Select City')
                ->setValue($info['city_id']);
        foreach ($cityArray as $value) {
            $city->addMultiOption($value->id, $value->name);
        }

        #id
        $id = new Zend_Form_Element_Hidden('id');
        $id->setValue($info['id']);

        #submit
        $submit = new Zend_Form_Element_Submit('submit');
        $submit->setLabel('Update Zipcode')
                ->setAttribs(array('class' => 'btn btn-success'));

        $this->addElements(array($name, $city, $id, $submit));
    }

}

